The approaches described in this section could be pursued but are not necessarily approaches that have previously been conceived or pursued. Therefore, unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section.
Conventionally, a virtual environment may include a hypervisor that is responsible for creating and running virtual machines. A system on which the hypervisor is running the virtual machines may be defined as a host or a virtual host. In the virtual environment, the hypervisor or the host can facilitate communications between multiple networks. Each of these networks may have a plurality of virtual machines. Some of these virtual machines may run on the same hypervisor despite being part of different networks.
A virtual machine of one network may attempt to communicate with a virtual machine of another network. Typically, when the first virtual machine sends data packets to the second virtual machine, the data packets need to be routed according to the traditional routing protocol and may involve sending the data packets via an external routing environment, even if both virtual machines are running on the same host. The external routing environment may be responsible for inspecting the data packets and determining, based on some predetermined policies, whether to allow the data packets to be routed between the first virtual machine and the second virtual machine. If the data packets are allowed, the hypervisor may route the data packet between the first virtual machine and the second virtual machine. Similarly, when the second virtual machine replies to the first virtual machine, a response data packet of the second virtual machine may also need to be routed to the external routing environment to determine whether the response data packet is allowed for routing to the first virtual machine. However, routing data packets between two virtual machines hosted by the same server, via an external routing environment, can result in inefficiencies in data communications between these virtual machines. Thus, intra-server data communication between virtual machines associated with different networks may be resource consuming, result in unnecessary utilization of network routing equipment, and limit the network bandwidth.